package vip.zhenzicheng.nettyadv.cryocodec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ByteToMessageDecoder;

import java.util.List;

/**
 * @author zhenzicheng
 * @date 2022-06-14 09:15
 */
public class KryoDecoder extends ByteToMessageDecoder {

  @Override
  protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {
    Object obj = KryoSerializer.deserialize(byteBuf);
    list.add(obj);
  }
}
